<?php
$c = Yii::app()->controller->getId();
$a = array('class' => 'active');

$this->widget('zii.widgets.CMenu',array(
	'items'=>array(
		//array('label' => 'Dashboard', 'url' => array('/admin')),
		array(
			'label' => Yii::t('app', 'product'), 
			'url' 	=> array('/admin/product'),
			'items' => array(
				array('label' => Yii::t('app', 'create new product'), 'url' => array('/admin/product/create')),
				array('label' => Yii::t('app', 'manage product'), 'url' => array('/admin/product')),
				array('label' => Yii::t('app', 'create new category'), 'url' => array('/admin/productCategory/create')),
				array('label' => Yii::t('app', 'manage category'), 'url' => array('/admin/productCategory'))
			),
			'itemOptions' => $c == 'product' ? $a : array(),
		),
		array(
			'label' => Yii::t('app', 'post'),
			'url' 	=> array('/admin/post'),
			'items' => array(
					array('label' => Yii::t('app', 'create new post'), 'url' => array('/admin/post/create')),
					array('label' => Yii::t('app', 'manage post'), 'url' => array('/admin/post')),
					array('label' => Yii::t('app', 'create new category'), 'url' => array('/admin/postCategory/create')),
					array('label' => Yii::t('app', 'manage category'), 'url' => array('/admin/postCategory'))
			),
			'itemOptions' => ($c == 'post' ? $a : array())
		),
		array(
			'label' => Yii::t('app', 'Page single'),
			'url' 	=> array('/admin/page'),
			'items' => array(
					array('label' => Yii::t('app', 'create new page'), 'url' => array('/admin/page/create')),
					array('label' => Yii::t('app', 'manage page'), 'url' => array('/admin/page'))
			),
			'itemOptions' => $c == 'page' ? $a : array()
		),
		array(
			'label' => Yii::t('app', 'site'),
			'url' 	=> array('##'),
			'items' => array(
					array('label' => Yii::t('app', 'site setting'), 'url' => array('/admin/siteSetting')),
					array('label' => Yii::t('app', 'site info'), 'url' => array('/admin/siteInfo')),
			),
			'itemOptions' => (($c == 'siteInfo' || $c == 'siteSetting') ? $a : array())
		),
		array(
			'label' => Yii::t('app', 'menu'), 
			'url' => array('/admin/menu'),
			'itemOptions' => $c == 'menu' ? $a : array()
		),
		array(
			'label' => Yii::t('app', 'images management'), 
			'url' => array('/admin/default/images')
		),
		array(
			'label' => Yii::t('app', 'Logout') . '('. Yii::app()->user->name.')', 
			'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest, 'itemOptions' => array('style' => 'float:right')
		),
		array(
			'label' => Yii::t('app', 'Home'), 'url'=>array('/'), 
			'itemOptions' => array('style' => 'float:right'), 
			'linkOptions' => array('target' => '_blank')
		)
	)
)); 